let path = require('path')
const C = require('./config')
module.exports = {
    mode: C.mode,
    entry: {
        bundle: path.resolve(__dirname, './index.jsx')
    },
    output: {
        path: path.resolve(__dirname, './asset/js/'),
        filename: 'bundle.js',
    },
    resolve: {
        extensions: ['.js', '.jsx',]
    },
    module: {
        rules: [
            {
                test: /\.(js|jsx)$/,
                exclude: /node_modules/,
                use: ['babel-loader'],
            }
        ]
    },
    externals: [(function () {
        const IGNORES = ['electron', 'fs',]
        return function (context, request, callback) {
            if (IGNORES.indexOf(request) >= 0) {
                return callback(null, 'require(\'' + request + '\')')
            }
            return callback()
        }
    })()]
}
